/* eslint valid-jsdoc: "off" */

'use strict';
const path = require('path');

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
    /**
     * built-in config
     * @type {Egg.EggAppConfig}
     **/
    const config = (exports = {});

    // use for cookie sign key, should change to your own and keep security
    config.keys = appInfo.name + '_1584933866718_6505';

    // add your middleware config here
    config.middleware = [];

    config.security = {
        csrf: {
            enable: false,
        },
    };

    config.view = {
        root: [path.join(appInfo.baseDir, 'app/view')].join(','),
        mapping: {
            '.nj': 'nunjucks',
        },
        defaultViewEngine: 'nunjucks',
        defaultExtension: '.nj',
    };

    exports.static = {
        dir: [
            {
                prefix: '/public',
                dir: path.join(appInfo.baseDir, 'app/public'),
            },
            { prefix: '/lighthouse', dir: path.join(appInfo.baseDir, 'lighthouse') },
        ],
    };

    // add your user config here
    const userConfig = {
        // myAppName: 'egg',
    };

    return {
        ...config,
        ...userConfig,
    };
};
